Willson Graphics - A5 WDL CODE

MODIFIED NORMAL LENS FLARE by AlanLeary


--------------------------------------------------------------------------------

Modified Normal Lens Flare by AlanLeary

I said I would release my modified code, right? So here it is! 
I didn't finish it the way I wanted to. I wanted to make it like the sun, where all parts of the flare is shown, and when the middle part gets covered by something, the rest of it vanishes, but alas... I couldn't figure it out. 

So, someone, PLEASE, try and see if you can add this to this the code. 

Anyway, I slowed down the lens flare spread, made it go all the way down before disappearing, And made it appear where Unreal flares appear. The result is a commercial-quality lens flare, which looks somewhat better then the Unreal flares! 

Please try this out, and show pics of your level with it in use! 

BTW, select the flare flag for your flare object, or it won't look right. 


var flare_dist = 0; // well store the distance in it 

ACTION flare_ok // attach it to the flare sprite 
{ 
    MY.FLARE = ON;
    MY.BRIGHT = ON;
    MY.ALPHA = 40;
    WHILE (1) 
    { 
    flare_dist = vec_dist(PLAYER.X, MY.X) - 168; // distance between the player and flare 
    IF (flare_dist > 325) 
    { 
    flare_dist = 325; // dont let the flare sprite become extremely big 
    } 
    MY.SCALE_X = (flare_dist / 500 + 0.1); 
    MY.SCALE_Y = (flare_dist / 500 + 0.1); 
    IF (flare_dist < -40) 
        { 
        SET MY.INVISIBLE, ON; // if too close to the flare, remove it 
        } 
    ELSE 
       { 
       SET MY.INVISIBLE, OFF; // otherwise, make it visible 
       } 
   WAIT 1; 
   } 
} 

--------------------
 
 
 

 





--------------------------------------------------------------------------------
Willson Graphics - A4 WDL CODE

SCROLLING MESSAGES ON A PANEL


--------------------------------------------------------------------------------

WDL for Scrolling Messages on a Panel 

///////////////////////////////////////////////////////////////////////////////////
// This code is Copyright (C) 2000 by Ronny Funk all rights reserved //
// ----------------------------------------------------------------- //
// //
// This wdl template will scroll messages on a panel up or down. //
// You won't find definitions for pannels, buttons etc in here, but all //
// the code you need to perform a pagewise scroll (up/down). //
// The ACTIONs you should assign to your buttons are : //
// //
// - RPG_ScrollUp //
// - RPG_ScrollDown //
// //
// I have added an example action called DisplayScrollPan. It shows how //
// to initialize all the variables needed in the scroll action. //
// Your job is to add BMAP, Panel, button definitions and of //
// course thousands of different text entities, to make it work. //
// The Action RPG_ExitScroll is also only for reference, it contains //
// code that won't work for you either, unless you use the same names as //
// i use, but that should not be a problem ...... //
// //
// I hope i have everything included, since this file is not the one i //
// used to test this. The original code is part of the role playing //
// system i started working on, a couple of weeks ago. // 
// //
// Summary of changes : //
// -------------------- //
// //
// Date Description Author //
// ----------------------------------------------------------------------------- //
// 05.03.2000 created V1.0 code R. Funk //
// 25.07.2000 added panel and bmap definitions R. Funk //
// //
// //
// //
// If you should have any questions do not hastitate to mail to: //
// //
// RonaldFunk@aol.com (private mail, best at weekend and evening hours) //
// or //
// Ronald_Funk@bmc.com (company mail, working hours) //
///////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////
// change this, but it has to be the same as the number defined by the STRINGS //
// keyword of Text entity RPG_ScrollList. This was necessary because it seems //
// that it is not allowed to reference the STRINGS keyword in actions. It //
// produced ugly error messages ????? Have to verify this with JCL //
///////////////////////////////////////////////////////////////////////////////////

DEFINE LinesToDisplay, 10;

DEFINE FALSE, 0;
DEFINE TRUE, 1; 


SKILL RPG_CurrentLine {};
SKILL RPG_MaxLinesInText {};
SKILL RPG_LinesPerPage {VAL LinesToDisplay;}
SKILL RPG_Scroll {};
SKILL RPG_ScrollSubscript {};
SKILL RPG_LinesOnPage {};
BMAP RPG_ButtonMap, <bg611bt.pcx>;
BMAP RPG_Info1Map, <bg611nf1.pcx>;

///////////////////////////////////////////////////////////////////////////////////
// This synonym will be used to retrieve the text to scroll //
// This has to be set BEFORE any of the scroll actions is called the first time //
///////////////////////////////////////////////////////////////////////////////////

SYNONYM RPG_ScrollText {TYPE TEXT; }

///////////////////////////////////////////////////////////////////////////////////
// This is just a stupid example test Text Definition //
///////////////////////////////////////////////////////////////////////////////////

TEXT RPG_ScrollTestText {
POS_X 65;
POS_Y 268;
STRINGS 32;
FONT RPG_InfoFont;
STRING "Line 1 ";
STRING "Line 2 ";
STRING "Line 3 ";
STRING "Line 4 ";
STRING "Line 5 ";
STRING "Line 6 ";
STRING "Line 7 ";
STRING "Line 8 ";
STRING "Line 9 ";
STRING "Line 10 "; 
STRING "Line 11 ";
STRING "Line 12 ";
STRING "Line 13 ";
STRING "Line 14 ";
STRING "Line 15 ";
STRING "Line 16 ";
STRING "Line 17 ";
STRING "Line 18 ";
STRING "Line 19 ";
STRING "Line 20 ";
STRING "Line 21 ";
STRING "Line 22 ";
STRING "Line 23 ";
STRING "Line 24 ";
STRING "Line 25 ";
STRING "Line 26 ";
STRING "Line 27 ";
STRING "Line 28 ";
STRING "Line 29 ";
STRING "Line 30 ";
STRING "Line 31 ";
STRING "Line 32 ";
INDEX 1; 
}

///////////////////////////////////////////////////////////////////////////////////
// This Text will be used by the scroll actions to display whatever text you have//
// assigned to the synonym RPG_ScrollText //
// You can change whatever you want but keep the name RPG_ScrollList, if you //
// don't, the scroll actions will produce ugly error messages //
///////////////////////////////////////////////////////////////////////////////////

TEXT RPG_ScrollList {
POS_X 140;
POS_Y 310;
STRINGS 10;
FONT RPG_InfoFont;
STRING " ";
STRING " ";
STRING " ";
STRING " ";
STRING " ";
STRING " ";
STRING " ";
STRING " ";
STRING " ";
STRING " ";
INDEX 1;
LAYER 5;
}

PANEL RPG_Info1Pan
{
POS_X 61;
POS_Y 265;
BMAP RPG_Info1Map;
BUTTON 45, 40, RPG_ButtonMap, RPG_ButtonMap, RPG_ButtonMap, RPG_ScrollUp, NULL, NULL;
BUTTON 45, 60, RPG_ButtonMap, RPG_ButtonMap, RPG_ButtonMap, RPG_ScrollDown, NULL, NULL;
BUTTON 45, 80, RPG_ButtonMap, RPG_ButtonMap, RPG_ButtonMap, RPG_ExitScroll, NULL, NULL;
LAYER 4;
FLAGS REFRESH, OVERLAY;
}

///////////////////////////////////////////////////////////////////////////////////
// This string will be used to empty the ScrollList text variable //
// You can change the length, to match whatever you need, but keep the name //
///////////////////////////////////////////////////////////////////////////////////


STRING RPG_EmptyString, " ";

///////////////////////////////////////////////////////////////////////////////////
// exit the scroll panel. Reset synonym INDEX to 1 //
///////////////////////////////////////////////////////////////////////////////////

ACTION RPG_ExitScroll {
RPG_Scroll = FALSE;
SET RPG_Info1Pan.VISIBLE, FALSE;
SET RPG_ScrollList.VISIBLE, FALSE;
SET RPG_ScrollText.INDEX, 1;
}

///////////////////////////////////////////////////////////////////////////////////
// This action will perform the actuall scroll up. The scrolling behaviour is //
// page scroll. The real work is done by action RPG_DoScroll //
// Scroll Up requires a little bit more checks as scroll down but ..... //
// Assign it to a Button in a panel definition or whatever you like //
/////////////////////////////////////////////////////////////////////////////////// 

ACTION RPG_ScrollUp {

// Don't Scroll if first Page already displayed

IF (RPG_CurrentLine == RPG_LinesPerPage + 1) { END; } 

///////////////////////////////////////////////////////////////////////////////////
// see if we are on last page //
///////////////////////////////////////////////////////////////////////////////////

IF (RPG_LinesOnPage < RPG_LinesPerPage) {

RPG_CurrentLine = RPG_MaxLinesInText - RPG_LinesOnPage - RPG_LinesPerPage + 1;

}
ELSE {

RPG_CurrentLine = RPG_CurrentLine - (2 * RPG_LinesPerPage);

}

CALL _RPG_DoScroll;

}

///////////////////////////////////////////////////////////////////////////////////
// This action will perform the actuall scroll down. The scrolling behaviour is //
// page scroll. The real work is done by action RPG_DoScroll //
// Assign it to a Button in a panel definition or whatever you like //
///////////////////////////////////////////////////////////////////////////////////

ACTION RPG_ScrollDown {

// Don't Scroll if last Page already displayed

IF (RPG_ScrollText.INDEX == RPG_MaxLinesInText) { END; }

CALL _RPG_DoScroll;

}

///////////////////////////////////////////////////////////////////////////////////
// This helper action copies the strings from synonym RPG_SccrollText //
// to our scroll display text //
///////////////////////////////////////////////////////////////////////////////////

ACTION _RPG_DoScroll {

///////////////////////////////////////////////////////////////////////////////////
// Do some initialization like : //
// - clear the TEXT entity that will be displayed //
// - initialize the Scroll variable (used to control to number of times the //
// loop below will be executed //
// - point to the next string that will be displayed //
// - set the ScrollList string to be used next to 1 //
///////////////////////////////////////////////////////////////////////////////////

CALL _RPG_ClearScrollList; 
RPG_Scroll = 1;
SET RPG_ScrollText.INDEX, RPG_CurrentLine;
SET RPG_ScrollList.INDEX, RPG_Scroll;

WHILE (RPG_Scroll <= RPG_LinesPerPage) {
SET RPG_ScrollList.STRING, RPG_ScrollText.STRING;
RPG_Scroll += 1; 
RPG_ScrollSubscript = RPG_Scroll + RPG_CurrentLine - 1;
SET RPG_ScrollText.INDEX, RPG_ScrollSubscript;
SET RPG_ScrollList.INDEX, RPG_Scroll;
// special Handling for the Last Line
IF (RPG_ScrollText.INDEX == RPG_MaxLinesInText) {
SET RPG_ScrollList.STRING, RPG_ScrollText.STRING;
RPG_Scroll += 1;
BREAK; 
}
} 

RPG_LinesOnPage = RPG_Scroll - 1;
RPG_CurrentLine += RPG_Scroll - 1;
IF (RPG_CurrentLine > RPG_MaxLinesInText) { RPG_CurrentLine = RPG_MaxLinesInText + 1; }

}

///////////////////////////////////////////////////////////////////////////////////
// This helper action clears our scroll display text entity //
///////////////////////////////////////////////////////////////////////////////////

ACTION _RPG_ClearScrollList {
RPG_Scroll = 1;
SET RPG_ScrollList.INDEX, 1; 
WHILE (RPG_Scroll <= RPG_LinesPerPage) {
SET RPG_ScrollList.STRING, RPG_EmptyString;
RPG_Scroll += 1;
SET RPG_ScrollList.INDEX, RPG_Scroll;
}
}

//////////////////EXAMPLE of how to init the scroll actions////////////////////////
// This Action sets the synonym and makes a panel visible. This panel serves as //
// a background for the text to scroll. //
// Use this action as template to make scrolling work for many different text //
// entities. The following things have to be done : //
// - initialize the synonym RPG_ScrollText used in the scroll actions to //
// the text entity you want to scroll //
// - set RPG_CurrentLine to 1 //
// - set RPG_MaxLinesInText to the maximum number of STRING keywords contained //
// in the text entity you want to scroll // 
///////////////////////////////////////////////////////////////////////////////////

ACTION DisplayScrollPan {

// Set the synonym pointing to the text entity to be displayed
// this is the MOST important part ... You control what text will be
// displayed by setting this synonym 

SET RPG_ScrollText, RPG_ScrollTestText;

// This can also be done somewhere else, its just because i had to test

SET RPG_Info1Pan.VISIBLE, TRUE;

// initialize CurrentLine Variable used in scroll actions. Needs to be set to 1

RPG_CurrentLine = 1;

///////////////////////////////////////////////////////////////////////////////////
// Set to maximum number of STRING variables contained in the //
// Text entity to be displayed. This must only be done, because it seems //
// that the STRING keyword of the text entity is not referencable in actions //
// need to confirm this with JCL !!!!! //
///////////////////////////////////////////////////////////////////////////////////

RPG_MaxLinesInText = 32;

// now call the scroll down action to display the first junk of text

SET RPG_ScrollList.VISIBLE, TRUE;
CALL RPG_ScrollDown;
}

ON_S DisplayScrollPan; 











Willson Graphics - A4 WDL CODE

TIME KEEPER CODE


--------------------------------------------------------------------------------

/***************************************************************
* Time Manager, by Scott Pennell, Neonlite
* You are free to use this with or without my consent anyway you 
* like. Please send me feedback. This is my first major WDL code,
* but I have 15 years of professional C/C++/Java experience.
*
* Description:
* This is meant to keep the time of day in your game. It tracks
* Minutes, hours, days, day of the week, months, and year. To use,
* modify the parameters below for starting date/time, month names
* days of the week, etc. Make sure you read the comments! You can
* also speed up or slow down the passing of time by modifying
* TM_TICKS_PER_MINUTE which means game ticks per game minute.
* If its still too slow, you can change the line TM_MINUTE += 1;
* to TM_MINUTE += 2; but time will really start to fly as you
* increase that number!
*
* To use in your game, do the following:
* 0. Save this file as time.wdl in your game directory
* 1. INCLUDE <time.wdl>; // in your INCLUDE section of your game's 
* // main WDL file. 
* 2. CALL init_time; // in your game's main ACTION
* 3. CALL get_time; // or get_date or get_datetime
* This will update the strings TM_TIME, TM_DATE, or TM_DATETIME
* respectively. You can then use these STRINGS for setting msg.STRING
* or in panel text or do with them what you will. You must call the 
* get_ ACTIONS every time you want to display an updated value. To
* show the date and time always, use this:
*
* ACTION show_time
* {
* WHILE (1) {
* CALL get_datetime;
* SET_STRING msg.STRING, TM_DATETIME;
* WAITT 16;
* }
* }
* 
* in your main action, you must do this:
* ...
* SET msg.VISIBLE, ON;
* CALL show_time;
* ...
*
* Have fun and send feedback to the A4 forum or directly to me at
* scott@bluestone.com
***************************************************************/

SKILL TM_TICKS_PER_MINUTE { val 16; } // How fast the clock runs (16 ticks ~= 1 second)

SKILL TM_MINUTE { val 0; } // current minute
SKILL TM_HOUR { val 12; } // current hour
SKILL TM_DAY { val 1; } //current day
SKILL TM_MONTH { val 1; } // current month
SKILL TM_YEAR { val 1965; } // current year
SKILL TM_DOW { val 1; } // current day of the week

STRING TM_AMPM, "am"; // current meridian

// Months, change these to whatever you want, as long as there are 12
// modified by R. Funk to use TEXT and INDEX

TEXT month { 
POS_X 4; POS_Y 4; //not important because we don't use this for diplay 
FONT msg_font; 
STRINGS 12; 
STRING "January";
STRING "February";
STRING "March";
STRING "April";
STRING "May";
STRING "June";
STRING "July";
STRING "August";
STRING "September";
STRING "October";
STRING "November";
STRING "December";
INDEX 12; // points to last string 
} 

TEXT day { 
POS_X 4; POS_Y 4; //not important because we don't use this for diplay
FONT msg_font; 
STRINGS 7; 
STRING "Sunday";
STRING "Monday";
STRING "Tuesday";
STRING "Wednesday";
STRING "Thursday";
STRING "Friday";
STRING "Saturday"; 
INDEX 7; // points to last string 
} 

// If you make these more than 2 characters, make sure you make TM_AMPM at least as long
// as the longest one.
STRING TM_AM, "am";
STRING TM_PM, "pm";

// If you change month names & day names to really long ones, you may need to change
// the length of these strings or face string truncation.
STRING TM_TIME, " ";
STRING TM_DATE, " ";
STRING TM_DATETIME, " ";

// Do not change unless you know what you are changing!
SKILL TM_COUNT { val 0; }
STRING TM_COLON, ":";
STRING TM_COMMA, ", ";
STRING TM_SPACE, " ";
STRING TM_ZERO, "0";
STRING TM_DASH, " - ";
STRING TM_ERROR, "Error";

// Call this ACTION from your game's main ACTION
ACTION init_time
{
CALL TM_pass_time; 
}

// This is where time is tracked
ACTION TM_pass_time
{
WHILE (1) {
// Wait the allotted amount of time for 1 minute game time
WAITT TM_TICKS_PER_MINUTE;

// Increment game time by 1 minute (or more if you want faster time passing)
TM_MINUTE += 1;
IF (TM_MINUTE > 59) { // an hour passed
TM_MINUTE = 0;
TM_HOUR += 1;
IF (TM_HOUR > 11) { // change from am to pm?
SET_STRING TM_AMPM, TM_PM;
}
IF (TM_HOUR > 23) { // a day has passed
TM_HOUR = 0;
SET_STRING TM_AMPM, TM_AM;
TM_DAY += 1;
TM_DOW += 1;
IF (TM_DOW > 7) { // make sure day of week advances
TM_DOW = 1;
}
TM_COUNT = 100; // Set Error value if month is incorrect
// Handle Months (Sorry no leap year or millenia corrections)
// 31 Days in the month?
IF ((TM_MONTH == 1) || (TM_MONTH == 3) || (TM_MONTH == 5) || (TM_MONTH == 7) || (TM_MONTH == 8) || (TM_MONTH == 10) || (TM_MONTH == 12)) { 
TM_COUNT = 31;
}
// 30 Days in the month?
IF ((TM_MONTH == 4) || (TM_MONTH == 6) || (TM_MONTH == 9) || (TM_MONTH == 11)) { 
TM_COUNT = 30;
}
// Is it February? (always 28 days)
IF (TM_MONTH == 2) {
TM_COUNT = 28;
}
IF (TM_DAY > TM_COUNT) { // a month has passed
TM_DAY = 1;
TM_MONTH += 1;
IF (TM_MONTH > 12) { // a year has passed
TM_YEAR += 1;
TM_MONTH = 1;
}
}
}
}
}
}

STRING TM_S1, " ";
SKILL TM_V1 { val 0; }


// If someone knows a better way to manipulate strings, 
// please enlighten me. This is soooooooooooo tedious!
// call this to update the TM_TIME STRING.
ACTION get_time
{
TM_V1 = TM_HOUR;
IF (TM_V1 > 12) {
TM_V1 -= 12;
}
TO_STRING TM_S1, TM_V1;
SET_STRING TM_TIME, TM_S1;
ADD_STRING TM_TIME, TM_COLON; 
TO_STRING TM_S1, TM_MINUTE;
IF (TM_MINUTE < 10) {
ADD_STRING TM_TIME, TM_ZERO;
}
ADD_STRING TM_TIME, TM_S1; 
ADD_STRING TM_TIME, TM_SPACE; 
ADD_STRING TM_TIME, TM_AMPM; 
}

// Boy do i wish i had an array about now.
// I might even settle for an ELSE IF
// call this to update the TM_DATE STRING.


// modified to use INDEX keyword of WDL TEXT entity R.Funk

ACTION get_date
{
SET day.INDEX,TM_DOW; 
SET_STRING TM_DATE, day.STRING;
ADD_STRING, TM_DATE, TM_COMMA;

SET month.INDEX, TM_MONTH; 
ADD_STRING TM_DATE, month.STRING;

ADD_STRING, TM_DATE, TM_SPACE;
TO_STRING TM_S1, TM_DAY;
ADD_STRING TM_DATE, TM_S1;
ADD_STRING, TM_DATE, TM_COMMA;
TO_STRING TM_S1, TM_YEAR;
ADD_STRING TM_DATE, TM_S1;

}

// call this to update the TM_DATETIME STRING.
ACTION get_datetime
{
CALL get_date;
CALL get_time;
SET_STRING TM_DATETIME, TM_DATE;
ADD_STRING, TM_DATETIME, TM_DASH;
ADD_STRING, TM_DATETIME, TM_TIME;
}


Willson Graphics - A4 WDL CODE

ROTATING 3D PANEL


--------------------------------------------------------------------------------

//ROTATING 3D PANEL BY TESTER

ENTITY fwheld_pan // the rotating 3D panel
{
TYPE = <f_heldau.MDL>;
LAYER = 2;
FLAGS VISIBLE;
VIEW = CAMERA;
ALBEDO = 50;
PAN = 0;
X = 1000;
Y = 0;
Z = 12;
} 

FUNCTION rotate_held()// the rotating function 

{
WHILE (1)
{
WAIT 1;
fwheld_pan.PAN += 1;
IF ( fwheld_pan.PAN > 360 )
{ fwheld_pan.PAN = 0; }
fwheld_pan.X -= 5;
}
}




Willson Graphics - A4 WDL CODE

UNNOTICABLE LEVEL CHANGE


--------------------------------------------------------------------------------
//(HALF-LIFE) LEVEL CHANGE BY SKILLATOR 
This was posted by Skillator (July 21, 2000 07:26):
My -current- unnoticable* (half-life)level change: (this works for me)
///////////////////////////////////////
SKILL newX {}
SKILL newY {}
SKILL newZ {}
SKILL new_pan {}
SKILL new_tilt {}
SKILL new_roll {}
ACTION notthis_1_2 {
SET ME,NULL; /* now this action will be global, and keep running*/
newX = player.X;
newY = player.Y;
newZ = player.Z;
new_pan = player.PAN;
new_tilt = player.TILT;
new_roll = player.ROLL;
LOAD_LEVEL <Level2.wmb>;
WAIT 2; /* if empty synonym is called at impact increase*/
player.X = newX; /* displace the entity(-1200)?*/
player.Y = newY; /getting out of range yet?
player.Z = newZ + 40; /* there was a step in my way*/
player.PAN = new_pan;
player.TILT = new_tilt;
player.ROLL = new_roll;
}
ACTION Qload_1_2 {
SET MY.EVENT,_Qload_1_2_event;
SET MY.ENABLE_IMPACT,ON;
SET MY.ENABLE_PUSH,ON;
}

ACTION _Qload_1_2_event {
CALL move_1_2;
}
////////////////////////////////////////
parts are taken from WDL tutorial JCL and teleport template
I attatched this to an invisible WMB entity (a little piece stuck into the floor had to be visible to build it) (or do it in this code) which is placed in an area shared by 2 levels that have limited range of visibility, (like an S curve type hallway). And you can hardly tell you change levels *(1/8th sec. flash or pause) you keep youre exact position upon arrival in the next level, you can back through it, strafe into it, or superman spinning flip through it(I'd like to think) and you will appear in the next level comming out of that movement, positioned properly. The key to making it work is keeping the (fairly small) area you put the level changer in and changing the rest of the level so the coordinates of the player reletave to that of level 2 are the same. Also, if I just say wait 1 an error move_1_2 appeares upon impact of that entity, if this happens to you then wait some more. *Also there is a quick flash (eigth of a second) of the origional start position I'll work on this(FREEZ_MODE = 1?), but hey that's not to bad . Please use this and tell me (e-mail) how it works for you (or ask questions) whenever you've got the time. Thanks GEORGE & origionalshadowman.

Willson Graphics - A4 WDL CODE

ENEMY RADAR BY FourX Development


--------------------------------------------------------------------------------

this code is copyrighted by FourX Development Ltda - Brazil
Is free for use, no charge, but don't forget us on your credits. 

Joshua

//////////////////////////////////////////////////
// RADAR WDL					//
// ARQUIVO PARA INCLUSIO DE TODOS		//
// OS RECURSOS RADAR 				//
//////////////////////////////////////////////////
//Variveis do Radar
//Skill useds on Radar System
var radar_counter = 0; //Quantos alvos foram encontrados
//Count how many targets found
var radar_status = 0; //Indica se est ligado/desligado
//Radar Status on/off
var rs=2000; //Comprimento do Scan
//Lenght of Radar Scan
var temp2[3]; //Guarda a posio do alvo em relao a escala
//Receive the scale relative position
var temp3[3]; //Guarda o ngulo rotacionado
//Receive the angle correction 

//Bitmap para Radar
//Bitmaps using, for Radar and for Radar Blips
BMAP radare,<radare.bmp>;
BMAP radarv,<radarv.bmp>; 


//Painel para Radar
// Radar Panel
PANEL radar {
bmap = radarv;
flags = refresh,overlay;
pos_x = 25;
pos_y = 25;
layer=10;
} 

//Painel para Blips do radar
//Panel for Blips, only 10 blips
PANEL radar_1 {
bmap = radare;
flags = refresh,overlay;
layer=11; 

} 

PANEL radar_2 {
bmap = radare;
flags = refresh,overlay;
layer=11;
} 

PANEL radar_3 {
bmap = radare;
flags = refresh,overlay;
layer=11;
} 

PANEL radar_4 {
bmap = radare;
flags = refresh,overlay;
layer=11;
} 

PANEL radar_5 {
bmap = radare;
flags = refresh,overlay;
layer=11;
} 

PANEL radar_6 {
bmap = radare;
flags = refresh,overlay;
layer=11;
} 

PANEL radar_7 {
bmap = radare;
flags = refresh,overlay;
layer=11;
} 

PANEL radar_8 {
bmap = radare;
flags = refresh,overlay;
layer=11;
} 

PANEL radar_9 {
bmap = radare;
flags = refresh,overlay;
layer=11;
} 

PANEL radar_0 {
bmap = radare;
flags = refresh,overlay;
layer=11;
} 


//Funo para acionar o Radar
//Function to turn on/off radar
FUNCTION radar_scan()
{
//Verifica se o Radar est ligado
//Look if radar is on or off
IF (radar_status == 0) {
//Liga o Radar
//Turn on Radar
radar_status = 1;
//Deixa o BitMap do Radar visivel
//Put BitMap visible
radar.visible = on;
//Zera o Contador do Radar
//Initiate Radar Counter
radar_counter=0;
}
Else {
//Desliga o Radar
//Turn off Radar
radar_status = 0;
//Deixa o BitMap do Radar invisvel
//Hide it
set radar.visible,off;
//Deixa os BitMaps dos Blips do Radar invisvels
//Hide all blips
set radar_1.visible,off;
set radar_2.visible,off;
set radar_3.visible,off;
set radar_4.visible,off;
set radar_5.visible,off;
set radar_6.visible,off;
set radar_7.visible,off;
set radar_8.visible,off;
set radar_9.visible,off;
set radar_0.visible,off;
}
//Radar Loop
while(radar_status == 1){
//Guarda a posio da Camera
//Get Camera Position
my_pos.X = CAMERA.X;
my_pos.Y = CAMERA.Y;
my_pos.Z = CAMERA.Z;
//Guarda o ngulo da Camera
//Get Camera Angle
my_angle.PAN = CAMERA.PAN;
my_angle.TILT = CAMERA.TILT;
//Seta o Tamanho do Scan
//Set the scan ray
temp.PAN = 360;
temp.TILT = 360;
//Seta o Comprimento do Scan
//Set the scan lenght
temp.Z = rs;
//Deixa os Blips do Radar invisveis
//Turn off all blips
radar_1.visible = off;
radar_2.visible = off;
radar_3.visible = off;
radar_4.visible = off;
radar_5.visible = off;
radar_6.visible = off;
radar_7.visible = off;
radar_8.visible = off;
radar_9.visible = off;
radar_0.visible = off;
//Zera o Contador do Radar
//Initiate radar counter
radar_counter = 0;
//Seta o Tipo de Scan para RADAR = 1
//Adivise the scan type, 1 = Radar, 2 = AutoTarget etc
scan_type = 1;
//Well, make SCAN
SCAN my_pos,my_angle,temp;
//Libera o Tipo de Scan
//Free scan type
scan_type = 0;
//Finaliza Loop
//Wait a little and re-start, loop, loop, loop
wait(1);
}
} 

//Action for your Enemy Event action
ACTION _enemy_event {
//If event is a Scan and I'm (enemy) live
IF (EVENT_TYPE == EVENT_SCAN && MY._HEALTH > 0) {
//Se o tipo do SCAN for de Radar
//If scan type is 1, that a Radar Scan
if (scan_type == 1)
{
//call the function to turn on blips
radar_detect();
}
}
} 

//This function will put the blips on screen
FUNCTION radar_detect(){
//Atualiza contador de alvos detectados
//Count how much targets
radar_counter += 1;
//Se for o primeiro alvo detectado
//if the first target
if (radar_counter == 1){
//Guarda a posio do alvo na escala em relao ao Player
//48 = raio do radar
//Get the postion of target in a relative scale of player position
//48 = radar ray in pixels
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
//Guarda o ngulo do Player rotacionado 1 quadrante em sentido anti-horrio
//Get tha player angle, roll 1 quadrant in counter-clock way
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
//Rotaciona a posio na escala pelo ngulo no quadrante correto
//Roll the vector to make relative of the player PAN
vec_rotate (temp2, temp3);
//Atualiza a posio do Blip no Radar
//25  o tamanho da margem
//64  metade da largura da figura do Radar
//48  metade da algura da figura do radar
//Now is time to show the Radar Blip for this target
//25 is the leng of x0 y0 and the radar bitmap
//64 is the half of radar bitmap width
//48 is the half of radar bitmap height
radar_1.pos_x = temp2.Y + 25 + 64 - (bmap_width(radare)/2);
radar_1.pos_y = temp2.X + 25 + 48 - (bmap_height(radare)/2);
//Deixa o Blip do Radar visvel
//Really, turn on NOW
radar_1.visible = on;
//Espera 1/16 de segundo
//wait a little
waitt(1 * TIME);
}
//If is the second target.......and so one
//This code is for 10 targets
if (radar_counter == 2){
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
vec_rotate (temp2, temp3);
radar_2.pos_x = temp2.y + 25 + 64 - (bmap_width(radare)/2);
radar_2.pos_y = temp2.x + 25 + 48 - (bmap_height(radare)/2);
set radar_2.visible,on;
waitt(1 * TIME);
}
if (radar_counter == 3){
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
vec_rotate (temp2, temp3);
radar_3.pos_x = temp2.y + 25 + 64 - (bmap_width(radare)/2);
radar_3.pos_y = temp2.x + 25 + 48 - (bmap_height(radare)/2);
set radar_3.visible,on;
waitt(1 * TIME);
}
if (radar_counter == 4){
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
vec_rotate (temp2, temp3);
radar_4.pos_x = temp2.y + 25 + 64 - (bmap_width(radare)/2);
radar_4.pos_y = temp2.x + 25 + 48 - (bmap_height(radare)/2);
set radar_4.visible,on;
waitt(1 * TIME);
}
if (radar_counter == 5){
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
vec_rotate (temp2, temp3);
radar_5.pos_x = temp2.y + 25 + 64 - (bmap_width(radare)/2);
radar_5.pos_y = temp2.x + 25 + 48 - (bmap_height(radare)/2);
set radar_5.visible,on;
waitt(1 * TIME);
}
if (radar_counter == 6){
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
vec_rotate (temp2, temp3);
radar_6.pos_x = temp2.y + 25 + 64 - (bmap_width(radare)/2);
radar_6.pos_y = temp2.x + 25 + 48 - (bmap_height(radare)/2);
set radar_6.visible,on;
waitt(1 * TIME);
}
if (radar_counter == 7){
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
vec_rotate (temp2, temp3);
radar_7.pos_x = temp2.y + 25 + 64 - (bmap_width(radare)/2);
radar_7.pos_y = temp2.x + 25 + 48 - (bmap_height(radare)/2);
set radar_7.visible,on;
waitt(1 * TIME);
}
if (radar_counter == 8){
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
vec_rotate (temp2, temp3);
radar_8.pos_x = temp2.y + 25 + 64 - (bmap_width(radare)/2);
radar_8.pos_y = temp2.x + 25 + 48 - (bmap_height(radare)/2);
set radar_8.visible,on;
waitt(1 * TIME);
}
if (radar_counter == 9){
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
vec_rotate (temp2, temp3);
radar_9.pos_x = temp2.y + 25 + 64 - (bmap_width(radare)/2);
radar_9.pos_y = temp2.x + 25 + 48 - (bmap_height(radare)/2);
set radar_9.visible,on;
waitt(1 * TIME);
}
if (radar_counter == 10){
temp2.x = ((my.X - player.x) * (48/rs));
temp2.y = ((my.y - player.y) * (48/rs));
temp2.z = me.z;
temp3[0] = 180 - player.pan;
temp3[1] = 0;
temp3[2] = 0;
vec_rotate (temp2, temp3);
radar_0.pos_x = temp2.y + 25 + 64 - (bmap_width(radare)/2);
radar_0.pos_y = temp2.x + 25 + 48 - (bmap_height(radare)/2);
set radar_0.visible,on;
waitt(1 * TIME);
} 

} 


//Call Radar when press R key
ON_R = radar_scan;



--------------------------------------------------------------------------------

100+ 

Joshua
Willson Graphics - A4/A5 WDL CODE

NIFTY FOG EFFECT BY MICHAEL DREWRY (AKA LOST4EVER)


--------------------------------------------------------------------------------

/////////////////////////////////////////////////////////////////////////////
// Nifty fog effect by me (Michael Drewry a.k.a Lost4Ever) 

var fog_test = 0; // this variable checks the current state of the fog 

function create_fog()
{
if(fog_test == 0) // if no fog already
{
bg_color.x = 255; // These variables set the color of the foggy sky
bg_color.y = 255; // Make sure the color is the same as your fog color
bg_color.z = 255;
fog_color = 1; //choose whatever fog color you want
fog_test = 1;
scene_map = null; //Get rid of the backgrounds
sky_map = null;
cloud_map = null;
while(camera.fog < 80) // Roll the fog in (Thanks Keebo)
{
camera.fog += 1;
wait(1);
}

}
else // if there is already fog
{
fog_test = 0;
while(camera.fog > 0) // Roll the fog out
{
camera.fog -= 1;
wait(1);
}
scene_map = mountain_map; // Put the backgrounds back
sky_map = sky1_map;
cloud_map = sky2_map;
}

}
//////////////////////////////////////////// 

/*This is a brute force method, a lot more control can be achieved by replacing some of the numbers with variables, but I will leave that up to you. Check it out and let me know if it works for you. I have to give credit to Keebo for the fade loops, for some reason I couldn't come up with that on my own. I guess I just couldn't see the fog through the haze*/


Willson Graphics - A5 WDL CODE

BOW AND ARROW CODE BY LOGAN SMITH


--------------------------------------------------------------------------------

//Bow and Arrow Code by Logan Smith 

//Arrow of Evil (credit is required with this one because of the difficulty)


code: 
--------------------------------------------------------------------------------

//particle action:
function dark_particle()
{
    MY_COLOR.RED = 128;
    MY_COLOR.BLUE = 128;
    MY.COLOR.GREEN = 32;
    MY_ACTION hurt_me;
//  particle_scatter();
}
ACTION hurt_me
{
if(EVENT_TYPE = EVENT_IMPACT) {your._HEALTH -= 10;}
}

//arrow action
function arrow()
{
WAIT(1);
MY._current_arrows -= 1;//when fired, take away an arrow
WHILE (my._firing == ON)
{
MY.X += 1;//change this to adjust the speed of the arrow
MY.LIGHTRED = 128;
MY.LIGHTGREEN = 32;
MY.LIGHTBLUE = 128;
EMIT(200,my.x,dark_particle();
WAITT(1);
if(EVENT_TYPE == EVENT_IMPACT && YOU != player)
{YOUR._HEALTH -= 5; MY._firing = OFF;REMOVE ME;}//change to adjust arrow damage
}
}



--------------------------------------------------------------------------------


This will give you an arrow that when fired, leaves a trail of permanently lasting purple particles that when touched, take 10 health away. To make the particles die after awhile uncomment the line that says "particle_scatter();". 
This code is Copyright (C) 2001 Logan Smith. All rights reserved. Free for commercial or professional use as loong as I am credited.



Willson Graphics - A5 WDL CODE

NIGHT VISION - BY SKATER


--------------------------------------------------------------------------------

// Night Vision Code by Skater, Clemens and Zero Interactive. 

// If you use this in a game (commercial or freeware), contact Skater as he has a pic you must display in the beginning of the game. 

//Here is the Nightvision snippet.

//Put this at the top of your script:


code: 
--------------------------------------------------------------------------------

PANEL night_vision {
BMAP nvision;
POS_X 0;
POS_Y 0;
LAYER 3;
FLAGS REFRESH,TRANSPARENT;
}


--------------------------------------------------------------------------------

Put this somewhere else: 

  

code: 
--------------------------------------------------------------------------------

ACTION _nightvision {
	IF (night_vision.VISIBLE == OFF) {
		SET night_vision.VISIBLE,ON;
		CAMERA.AMBIENT +=50;
	} ELSE {
		SET night_vision.VISIBLE,OFF;
		CAMERA.AMBIENT -=50;
	}
}
ON_N _nightvision;

Willson Graphics - A5 WDL CODE

BODY ARMOR BY SKATER


--------------------------------------------------------------------------------

//Code by Skater, Clemens and Zero Interactive. 

// If you use this in a game (commercial or freeware), contact Skater as he has a pic you must display in the beginning of the game. 

////////////////////////////////
Body Armor:  By Skater


code: 
--------------------------------------------------------------------------------

ACTION ItemArmor {
	IF (MY.SKILL5 == 0) { MY.SKILL5 = 100; }
	SET MY.EVENT,_armor_pickup;
	CALL _item_pickup;
}
ACTION _armor_pickup {
IF (EVENT_TYPE == EVENT_PUSH && YOU != player) { RETURN; } 

IF (YOU == NULL) { SET YOU,player; }
IF (YOU == NULL) { RETURN; } 

YOUR._HEALTH += MY.SKILL5;
IF (YOUR._ARMOR > 100) { YOUR._ARMOR = 100; }
IF (YOUR._ARMOR < 100) {
PLAY_SOUND health_fetch,50;
SET msg.STRING,got_body_str;
REMOVE ME; }
}



--------------------------------------------------------------------------------

Place the above anywhere in your script. 

////////////////////////////////////////

Willson Graphics - A5 WDL CODE

CLOSE ATTACKING CODE BY STATIC


--------------------------------------------------------------------------------

Ok I have heard alot of people want his code.. just as I did when I begun. It is actually really easy.. juts call this function in your player.. or your attached entity to the player or WHATEVER... I wont write ALL your code for you!  
// Code: By Static 


// I have seen many people ask for this code 

// Here it is.. 
// All you need to do.. is make the animations
// If you want you can use guard.mdl .. it works fine
//////////////////////////////////////////////////////////////////
// Scan for damage created by weapon or fist
/////////////////////////////////////////////////////////////////
var tip[3]; // vertex co-ordinates of the tip and hilt
var base[3]; // Could also be Beginning of Arm and end of Fist 

ACTION melee // Gives the blade an... edge
{
while (1){
ent_vertex(tip,?); // Put the vertex number for the tip of the weapon (fist or sword etc)
ent_vertex(base,?); // Put the vertex number for the base (hilt or shoulder)
trace_mode = ignore_passable + ignore_me + activate_shoot; 
TRACE (base, tip); // shoot a ray between to two positions constantly
my._damage = 0; // if it hits the player, no damage to him
if (result != 0) // if it is hitting something
{
if (you != player) // if it is NOT hitting the player
{
emit(10,TARGET,particle_scatter); // emit sparks
my._damage = 5;
if (snd_playing(hit_snd) == 0) {play_entsound (my, hit_snd, 50);} // sound from Venture
} 
}

wait 1; }
} 

// Then set up an attacking animation, and get it to run
// if(KEY_CTRL == 1)||(MOUSE_LEFT == 1) 
// Don;t forget to animate one if (force.x != 0) and the player is walking
// Don't forget to make one if (KEY_SHIFT == 1) if you want them to punch/swing/whatever and run 


// YOU HAVE TO CHANGE SOME OF WAR.WDL ALSO!!!
// Move it to this game directory AND rename it (remember to change the "INCLUDE <war.wdl>;" 

// Then change the function that follows..or just overide it and put it in your main coe
// As i changed war.wdl alot.. i just changed it in that file
/////////////////////////////////////
// Edited
function fight_event(){ 
if((EVENT_TYPE == EVENT_SCAN && indicator == _EXPLODE) 
|| (EVENT_TYPE == EVENT_SHOOT))
{ 
MY._SIGNAL = _DETECTED; // by shooting, player gives away his position 
if (indicator == _EXPLODE) { // reduce damage according to distance
damage *= max(0,(range - RESULT))/range; 
} 
if(MY._ARMOR <= 0) 
{ MY._HEALTH -= YOUR._damage;
} 
else 
{ 
MY._ARMOR -= YOUR._damage; 
} 
return; } 
if(EVENT_TYPE == EVENT_DETECT && YOU == player) { 
wait(1); //fix for dangerous instruction 
indicator = _WATCH; 
trace_mode = IGNORE_ME + IGNORE_PASSABLE + ACTIVATE_SHOOT; 
RESULT = trace(MY.POS,YOUR.POS); 
// if entity YOU was visible from MY position, its SHOOT event was triggered 
if(RESULT > 0) //&& (YOU == player)) // yes 
{ MY._SIGNAL = _DETECTED; 
} 
return; 
}
}
///////////////////////////////////////////// 

Any questions / quibbles etc.. just give me a buzz. 

I hope I cleaned the code up ok.. and it is understandable.. it is actually really straight forward.
-Static 
 
 
 
Willson Graphics - A5 WDL CODE

RIPPLE WATER EFFECTS BY STATIC707


--------------------------------------------------------------------------------

 

Yeah water effects. 
Saw this post and ran off and made one.. the waves when someone his the water.
Only 1 problem they don't get bigger (which they should). 

Its pretty straight forward I have been thinking about doing it for sometime. Have a look at it...
////////////////////////////////////////////////////////////////////////
// Created by Static707
// http://clix.to/Static707/
// Ripple water effect
FUNCTION water_sprite
{
// size
my.scale_x = 0.5 + (1 * TIME);
my.scale_y = 0.5;
my.scale_z = 0.5;
my.z = my.z + 1; 
ent_alphaset(0,-1); 
MY.flare = Off;
MY.transparent = ON; //inverse alpha
MY.passable = ON;
MY.oriented = ON; 
MY.tilt = 90; // set it flat onto the floor
MY.roll = 0;
waitt 18;
remove (me);
} 

// NOTE to change: Needs have fade slowly rather than disappear
////////////////////////////////////////////////////////////////////////
// Little splashes effect
// Someone can add this - a particle scatter should be enough 

////////////////////////////////////////////////////////////////////////
// Action for the entity
FUNCTION water_effects
{
while (1)
{
if (MY._MOVEMODE == _MODE_WADING)
{
vec_set(temp, my.x); 
temp.z -= 500; 
trace_mode = ignore_me + ignore_sprites; 
trace (my.x, temp); // look for water level
create(<water.pcx>,target,water_sprite); // create the sprite there
}
waitt 2;
}
}
//////////////////////////////////////////////////////////////////////// 

--------------------

-Static707
Armada Animations
 
 
 





--------------------------------------------------------------------------------
Willson Graphics - A5 WDL CODE

Sword Fighting A.I. by Nizzy


--------------------------------------------------------------------------------

SWORD FIGHTING AI by NIZZY

//Here it is, I'ts still pretty messy, but I'll fix it soon. 
/////////////////////////////////////////////////
define ud_wait,0;
define ud_attack,1;
define ud_approach,2;
define ud_die,4; 

define body,skill29;
define undead,0;
define flesh,1;
define metal,2;
define _verts,skill36; 

function body_hit_effect()
{
if(your.body == undead){ effect(particle_undead,1,target,nullvector);}
if(your.body == flesh){ effect(particle_blood,1,target,nullvector);}
if(your.body == metal){ effect(particle_metal,1,target,nullvector);}
} 

function body_die_effect()
{
temp = random(my._verts);
ent_vertex(temp,temp);
if(my.body == undead){ effect(particle_undead,1,temp,nullvector);}
if(my.body == flesh){ effect(particle_blood,1,temp,nullvector);}
if(my.body == metal){ effect(particle_metal,1,temp,nullvector);}
} 

bmap blood_map = <blood.tga>;
bmap undead_map = <undead.bmp>; 

function vec_blood(&vec)
{
vec[0] = random(2) -1;
vec[1] = random(2) -1;
vec[2] = random(2) -1;
} 

function func_fadeout()
{
my.alpha -= my.skill_x * time;
my.size += my.skill_y * time;
if(my.alpha < 0) { my.lifespan = 0; }
} 

function particle_blood
{
vec_blood(temp);
vec_set(my.vel_x,temp);
my.move = on;
my.flare = on;
my.size = 20;
my.alpha = 25;
my.bmap = blood_map;
my.lifespan = 100;
my.skill_x = 1;
my.gravity = 0;
my.function = fade_func;
} 

function particle_undead
{
vec_blood(temp);
vec_set(my.vel_x,temp);
my.move = on;
my.flare = on;
my.size = 20;
my.alpha = 50;
my.bmap = undead_map;
my.lifespan = 100;
my.skill_x = 2;
my.gravity = 0;
my.function = fade_func;
} 

function particle_metal()
{
vec_fountain(temp);
vec_set(my.vel_x,temp); //set the velocity
my.lifespan = 50;
my.flare = on; //flare transparency
my.bright = on; //glowing effect
my.move = on; //move according to vel_x, vel_y, and vel_z
my.streak = on; //new streak effect
my.bmap = orange_map;
my.gravity = 3;
my.alpha = 50;
my.size = 10;
my.function = particle_alpha_fade; //fade out near end of life
} 

function undead_init()
{
my.enable_shoot = on;
my.enable_scan = on;
my.enable_detect = on;
my.body = undead;
} 

function undead_event()
{
if(my._health <= 0) { undead_die(); }
} 

function undead_die()
{
my._state = ud_wait;
my._animdist = 0;
my.event = null;
my.enable_shoot = off;
my.enable_scan = off; 
my.transparent = on;
my.bright = on;
my.alpha = 100;
while(my._animdist <= 100) {
ent_frame("death",my._animdist);
my._animdist += 7 * time;
wait(1);}
my.passable = on;
wait(20);
while(my.alpha > 0)
{
body_die_effect();
my.alpha -= time * 5;
my.z -= time * 0.5;
wait(1);
}
ent_remove(my);
} 

action skeleton
{
wait(1);
undead_init();
my.skill30 = 291; //vertex # at hilt
my.skill31 = 300; //vertex # at point of blade
my._verts = 324; //# of verts in the model
my._health = 10; //starting health
my.event = undead_event;
my._state = ud_wait;
undead_wait();
} 

function undead_wait()
{
my._state = ud_wait;
my._animdist = 0;
while(my._state == ud_wait)
{
if(my._health <= 0) { undead_die(); return;}
ent_cycle("stand",my._animdist);
my._animdist += 5 * time;
if(my._animdist >= 100) { my._animdist -= 100; }
force = 0;
actor_move();
if(vec_dist(player.x,my.x) <= 1000) {
undead_approach();}
wait(1);
}
} 

function undead_approach()
{
my._state = ud_approach;
my._animdist = 0;
while(my._state == ud_approach && vec_dist(player.x,my.x) > 45)
{
if(my._health <= 0) { undead_die(); return;}
ent_cycle("run",my._animdist);
my._animdist += 5 * time;
if(my._animdist >= 100) { my._animdist -= 100; }
temp.x = player.x - my.x;
temp.y = player.y - my.y;
temp.z = player.z - my.z;
vec_to_angle(my_angle,temp);
force = 3;
actor_turn();
force = 3;
actor_move();
wait(1);
}
undead_attack();
} 

function undead_attack()
{
my._state = ud_attack;
my._animdist = 0;
while(my._state == ud_attack && vec_dist(player.x,my.x) < 50)
{
my._animdist = 0;
while(my._animdist <= 100) {
if(my._health <= 0) { undead_die(); return;}
ent_frame("attack",my._animdist);
my._animdist += 15 * time;
//
ent_vertex(p,my.skill30);
ent_vertex(p2,my.skill31);
trace_mode = IGNORE_ME + IGNORE_PASSABLE + ACTIVATE_SHOOT;
trace(p2,p);
if(YOU != NULL) {
your._health -= 1;
body_hit_effect();}
//
wait(1);}
/* ent_vertex(p,my.skill30);
ent_vertex(p2,my.skill31);
trace_mode = IGNORE_ME + IGNORE_PASSABLE + ACTIVATE_SHOOT;
trace(p2,p);
if(YOU != NULL) {
your._health -= 10;
body_hit_effect();}
wait(1);*/
my._animdist = 0;
while(my._animdist <= 100) {
if(my._health <= 0) { undead_die(); return;}
ent_frame("recoil",my._animdist);
my._animdist += 20 * time;
//
ent_vertex(p,my.skill30);
ent_vertex(p2,my.skill31);
trace_mode = IGNORE_ME + IGNORE_PASSABLE + ACTIVATE_SHOOT;
trace(p2,p);
if(YOU != NULL) {
your._health -= 1;
body_hit_effect();}
//
wait(1);}
wait(1);
}
undead_approach();
} 

function add_health()
{
your._health += my.skill3;
if(your._health > 100){your._health = 100;}
effect(particle_health,10,my.x,nullvector);
ent_remove(my);
} 

action health_vial
{
my.transparent = on;
my.bright = on;
my.alpha = 100;
my.enable_push = on;
my.event = add_health;
my.skill1 = random(360);
my.skill2 = my.z;
my.skill3 = 10;
my.push = -10;
while(1)
{
my.skill1 += time * 10;
my.z = my.skill2 + sin(my.skill1 * 2);
wait(1);
}
}
/////////////////////////////////////////////////
Notice the my.skill30 and 31, put the vertex # from med of the start and point of the blade. I'm not sure I put them in the right order, if blood spurts from behind the player when he's hit, fron in front, switch the 2 #s. Also you should have a blood.tga image for the blood particles as well as an undead.bmp, change the filenames if you want. There is also a health vial snippet at the end of it, assign health_vial to a potion model slightly above ground level. This might have flaws, but I pieced it together the best I could... I originally put some of this in movement.wdl!!(mainly because it was used with the player as well for the hit effects etc.) 

Sorry I didn't just upload it to my webpage... people seem to never be able to d/l it

--------------------

If ones house is ones castle,
the home office is the dungeon.
 
 
 

 
